<%= form_tag({action: :upload}, multipart: true, remote: true, class: 'hidden-file-input', id: 'upload_excel_form') do %>
  <%= file_field_tag 'upload_excel_file', accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' %>
<% end %>
<a href="#" class="btn btn-primary pull-right" id="upload_excel_btn">上传 Excel</a>
<script>
$(document).ready(function(){
  $(document).on('click', '#upload_excel_btn', function(){
    $('#upload_excel_file').click();
  });
  $(document).on('change', '#upload_excel_file', function(){
    $('#upload_excel_form').submit();
  });
})
</script>
<style>
#upload_excel_btn{
  cursor: pointer
}
</style>
